package com.example.find_module.find.fragments.attention;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewbinding.ViewBinding;

import com.example.common.mvvm.view.BaseFragment;
import com.example.find_module.databinding.FragmentAttentionchildBinding;
import com.example.find_module.find.fragments.attention.entity.AttbenEntity;

import java.util.List;

public class Fragment_Attention extends BaseFragment<FragmentAttentionchildBinding,AttentionViewModel> {

    private AttentionAdapter attentionAdapter;

    @Override
    public View bindLayout() {
        return v.getRoot();
    }

    @Override
    public ViewBinding initBinding() {
        FragmentAttentionchildBinding fragmentAttentionchildBinding=FragmentAttentionchildBinding.inflate(inflater);
        return fragmentAttentionchildBinding;
    }

    @Override
    public void initView() {
        v.AttentionRe.setLayoutManager(new LinearLayoutManager(getContext()));
        attentionAdapter = new AttentionAdapter();
        v.AttentionRe.setAdapter(attentionAdapter);
    }

    @Override
    public void initData() {
        vm.attention_list.observe(this, new Observer<List<AttbenEntity>>() {
            @Override
            public void onChanged(List<AttbenEntity> attbenEntities) {
                attentionAdapter.setNewInstance(attbenEntities);
            }
        });
    }
}
